GtkMenu *menu;
GtkMenuPrivate *priv;
GtkStyleContext *context;
- gint width, height;
+ GtkAllocation allocation;
menu = GTK_MENU (widget);
priv = menu->priv;
context = gtk_widget_get_style_context (widget);
- width = gtk_widget_get_allocated_width (widget);
- height = gtk_widget_get_allocated_height (widget);
+ gtk_widget_get_allocation (widget, &allocation);
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
{
gtk_render_background (context, cr, 0, 0,
- width, height);
+ allocation.width, allocation.height);
gtk_render_frame (context, cr, 0, 0,
- width, height);
+ allocation.width, allocation.height);
if (priv->upper_arrow_visible)
gtk_css_gadget_draw (priv->top_arrow_gadget, cr);
int x, y;
gdk_window_get_position (priv->view_window, &x, &y);
+
cairo_rectangle (cr,
- x, y,
+ x - allocation.x, y - allocation.y,
gdk_window_get_width (priv->view_window),
gdk_window_get_height (priv->view_window));
cairo_clip (cr);
GtkCssNode *top_arrow_node, *bottom_arrow_node;
GtkBorder padding;
GtkWidget *widget;
+ GtkAllocation allocation;
gint x, y;
gint view_width, view_height;
widget = GTK_WIDGET (menu);
+ gtk_widget_get_allocation (widget, &allocation);
/* Move/resize the viewport according to arrows: */
- view_width = gtk_widget_get_allocated_width (widget);
- view_height = gtk_widget_get_allocated_height (widget);
+ view_width = allocation.width;
+ view_height = allocation.height;
get_menu_padding (widget, &padding);
view_width -= padding.left + padding.right;
view_height -= padding.top + padding.bottom;
- x = padding.left;
- y = padding.top;
+ x = allocation.x + padding.left;
+ y = allocation.y + padding.top;
top_arrow_node = gtk_css_gadget_get_node (priv->top_arrow_gadget);
gtk_css_node_set_visible (top_arrow_node, priv->upper_arrow_visible);